package com.s2.link;

public class LinkedListTest {
	
	public static void main(String[] args) {
		LinkedList list = new LinkedList();
		System.out.println("-----add---");
		list.addFirst(1);
		list.add(2);		
		list.add(3);
		list.print();
		
		System.out.println("-----findBy---");
		System.out.println(list.findByPosition(0));
		System.out.println(list.findByData(3));
		
		System.out.println("-----update---");
		list.updateByData(1, 3);
		list.updateByPosition(2, 8);		
		list.add(3, 9);
		list.print();
		
		System.out.println("-----remove---");
		list.remove(2);		
		list.print();
		
		System.out.println("-----reverser---");
		list.reverse();		
		list.print();
		
		System.out.println("-----checkCircle---");
		System.out.println(LinkedList.checkCircle(list));
		
		System.out.println("-----clear---");
		list.clear();
		list.print();
		
		System.out.println("-----merge---");
		LinkedList listA = new LinkedList();
		listA.add(1);
		listA.add(2);
		LinkedList listB = new LinkedList();
		listB.add(1);
		listB.add(2);	
		LinkedList listMerge = LinkedList.merge(listA, listB);
		listMerge.print();		
		
		System.out.println("-----deleteLastKth---");
		LinkedList.deleteLastKth(listMerge, 1);
		listMerge.print();
		
		System.out.println("-----palindrome---");
		listA.clear();
		listA.add(1);
		listA.add(2);
		listA.print();
		System.out.println(listA.palindrome());

	}
}
